﻿using System.ComponentModel.DataAnnotations.Schema;
using Abp.Domain.Entities;
using Abp.Domain.Entities.Auditing;

namespace pandx.Mulan.Flows
{
    [Table("FlowInstances")]
    public class FlowInstance:FullAuditedEntity<long>,IMayHaveTenant
    {
        public int? TenantId { get; set; }
        public string Name { get; set; }
        public string Code { get; set; }
        public string FlowSchemeContent { get; set; }
        public long FlowSchemeId { get; set; }
        public string FlowSchemeName { get; set; }
        public string FormSchemeContent { get; set; }
        public FormType FormType { get; set; }
        public string FormData { get; set; }
        public long FormSchemeId { get; set; }
        public string FormSchemeName { get; set; }

        public string PrevNodeId { get; set; }
        public string RejectNodeId { get; set; }
        public string ActivityNodeId { get; set; }
        public string ActivityNodeName { get; set; }
        public string ActivityNodeType { get; set; }


        public string Description { get; set; }
        public string NextUserIds { get; set; }
        public FlowInstanceState State { get; set; }
        

        public FlowInstance Clone()
        {
            return this.MemberwiseClone() as FlowInstance;
        }

        public FlowInstance()
        {
            Description = "";
        }
    }

    public enum FlowInstanceState
    {
        Running=0, 
        Finished=1, 
        Recall=2,
        Deny=3,
        Rejected=4, 
        Draft=5 
    }
}
